home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Applications / Pict2Ascii 1.03 / Panes / CDynamicEditField.cp next >
Encoding:
Text File  |  1997-07-10  |  2.2 KB  |  68 lines  |  [TEXT/CWIE]

  1. // =================================================================================
  2. //    CDynamicEditField.cp                    ©1997 BB's Team inc. All rights reserved
  3. // =================================================================================
  4. #include "CDynamicEditField.h"
  5.  
  6. #include <UTextTraits.h>
  7. #include <UMemoryMgr.h>
  8. #include <LString.h>
  9.  
  10.  
  11. // ---------------------------------------------------------------------------------
  12. //        • Stream ctor
  13. // ---------------------------------------------------------------------------------
  14. CDynamicEditField::CDynamicEditField (LStream *inStream)
  15.     : LEditField (inStream)
  16. {}
  17.  
  18.  
  19. // ---------------------------------------------------------------------------------
  20. //        • CreateDynamicEditFieldStream [static]
  21. // ---------------------------------------------------------------------------------
  22. CDynamicEditField *
  23. CDynamicEditField::CreateDynamicEditFieldStream (LStream *inStream)
  24. {
  25.     return new CDynamicEditField (inStream);
  26. }
  27.  
  28.  
  29. // ---------------------------------------------------------------------------------
  30. //        • SetFontName (Str255)
  31. // ---------------------------------------------------------------------------------
  32. void CDynamicEditField::SetFontName (const Str255 inFontName)
  33. {
  34.     // Retrieve the present TT (this is made by GetResource underneath)
  35.     TextTraitsH theTTH = UTextTraits::LoadTextTraits (mTextTraitsID);
  36.  
  37.     // Lock it only in the block { }
  38.     {
  39.         StHandleLocker    lock ((Handle)theTTH);
  40.  
  41.         // Change the font name
  42.         LString::CopyPStr (inFontName, (**theTTH).fontName);
  43.         (**theTTH).fontNumber = UTextTraits::fontNumber_Unknown;
  44.  
  45.         // Tell UTextTraits to change the TT in TextEdit
  46.         UTextTraits::SetTETextTraits (*theTTH, mTextEditH);
  47.     }
  48.     
  49.     // clean up
  50.     ::ReleaseResource ((Handle)theTTH);
  51. }
  52.  
  53.  
  54. // ---------------------------------------------------------------------------------
  55. //        • DontBeTarget (Str255)
  56. // ---------------------------------------------------------------------------------
  57. void CDynamicEditField::DontBeTarget()
  58. {
  59. /*
  60.     Cannot call protected ancester...
  61. */
  62.     LEditField::DontBeTarget();
  63. //    StFocusAndClipIfHidden    focus(this);
  64. //    ::TEDeactivate(mTextEditH);        // Show inactive selection
  65. //    StopIdling();                            // Stop flashing the cursor
  66.     ProcessCommand (cmd_LooseFocus, nil);
  67. }
  68.